/*
 * @lc app=leetcode.cn id=404 lang=javascript
 *
 * [404] 左叶子之和
 */

// @lc code=start
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var sumOfLeftLeaves = function(root) {
    let res=0
    if(!root){
        return res
    }
    const queque=[root]
    while(queque.length){
        let node=queque.shift()
        if(node.left!==null&&node.left.left===null&&node.left.right===null){
            res+=node.left.val
        }
        node.left&& queque.push(node.left)
        node.right&&queque.push(node.right)
    }
    return res
};
// @lc code=end

